<%--
 *  File:    DayInvAnalysisDetail.jsp
 *  @Author: JackYin
 *  Date:    2011/07/04
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>
<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.DayInvAnalysisDetail"); 

	//init param
	String strModuleName = "COM";
	String privilegeCode = "ALL";
	String strTableName = "v_bifactofdatepurchase";
	String contextPath = request.getContextPath();
%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@ include file="/rpt/ReportURL.inc" %>

<html>
<head>
<title>DayInvAnalysisDetail.jsp</title>
<PageFlow:CheckPageFlow pageName="p_zylbifactofdatepurchase"/>
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%
Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
if(searchresults == null) searchresults = new Vector();
HashMap orginfo =(HashMap)pageContext.getAttribute("orginfo");
if(orginfo == null) orginfo = new HashMap();
Integer globalpccode = (Integer)orginfo.get("globalpccode");
%>
<script>
function page_summary(actionvalue,orderbyname){
	var editform = summaryPrepare(cform,actionvalue,orderbyname);
	editform.action = "DayPurAnalysisDetail.jsp?<%= OvalTools.randomURL() %>";
	editform.target = "_self";
	isRunning = true;
	editform.submit();  
}


function page_close(){
	window.close();
}
</script>
</head>
<body>
<% //--------------------------------------  page location --%>
<%@ include file="/inc/PageLocation.inc" %>
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_zylbifactofdatepurchase">
	<input type="hidden" name="actionname">
	<custom:hidden property="orgid"></custom:hidden>
	<custom:hidden property="itemid"></custom:hidden>
	<custom:hidden property="purchasedate"></custom:hidden>
	<custom:hidden property="vstartdate"></custom:hidden>
	<custom:hidden property="venddate"></custom:hidden>
	<custom:hidden property="vdate"></custom:hidden>
	<custom:hidden property="areaids"></custom:hidden>
  </tr>
    </td>
  </tr>
  <tr>
    <td colspan="2">
      <div style="width:100%;overflow=scroll;">
      <table width="320%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
   
         <tr  class="deepblue-left">
         
            <td class="title_center" width="80"><%= label.getLabelName("L_ComBuyer")+label.getLabelName("L_Province")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ComBuyer")+label.getLabelName("L_City")%></td>
            <td class="title_center" width="100"><%= label.getLabelName("L_ComBuyer")+label.getLabelName("L_Businessarea")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ComBuyer")+label.getLabelName("L_ProvinceOffice")%></td>
			<td class="title_center" width="100"><%= label.getLabelName("L_ComBuyer")+label.getLabelName("L_areaname")%></td>
            <td class="title_center" width="100"><%= label.getLabelName("L_CustomerUsr")%></td>
            <td class="title_center" width="100"><%= label.getLabelName("L_ComBuyer")+label.getLabelName("L_Code") %></td>
            <td class="title_center" width="200"><%= label.getLabelName("L_ComBuyer")+label.getLabelName("L_Name") %></td>
            <td class="title_center" width="200"><%= label.getLabelName("L_BuyerOriginalName")%></td>
            <td class="title_center" width="100"><%= label.getLabelName("L_ComBuyer")+label.getLabelName("L_Property")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_Chain")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_IsLocked") %></td>
            <td class="title_center" width="120"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_Province")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_City")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_Businessarea")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_ProvinceOffice")%></td>
			<td class="title_center" width="80"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_areaname")%></td>
			<td class="title_center" width="120"><%= label.getLabelName("L_DCustomerUsr")%></td> 
            <td class="title_center" width="85"><%= label.getLabelName("L_SellerCode")%></td>	
            <td class="title_center" width="200"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_Name") %></td>
            <td class="title_center" width="200"><%= label.getLabelName("L_SellerOriginalName")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_Status")%></td>
            <td class="title_center" width="120"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_PCCodeName")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ComSeller")+label.getLabelName("L_Property")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_Chain")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_IsLocked") %></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_YesOrNoTarget") %></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ProductCode")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_ProdName") %></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_PordSpan") %></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_DataCollectionInterval")%></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_PurchaseDate")%></td>
            <td class="title_center" width="50"><%= label.getLabelName("L_Qty") %></td>
            <!-- <td class="title_center" width="80"><%= label.getLabelName("L_SalesBehaviour") %></td> -->
            <td class="title_center" width="80"><%= label.getLabelName("L_SoType") %></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_DataType") %></td>
            <td class="title_center" width="80"><%= label.getLabelName("L_Type") %></td>
         </tr>
         <%
             int i = 0;
             String strClassType = new String(); 
         
          %>
          <logic:iterate id="summary" collection="<%= searchresults %>">                      
         <%
            HashMap summaryMap = (HashMap)pageContext.getAttribute("summary");
            if(summaryMap == null) summaryMap = new HashMap();
            
            if(i%2 == 1){
              strClassType = "td-listrom";             
            }else{                    
              strClassType = "";
            }
              
            i++;     
          %>
           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>">
           
           
            <td><custom:write property="regionname" name="summary"  nbsp="true"/></td>
            <td><custom:write property="cityname" name="summary" nbsp="true"/></td>
            <td><custom:write property="area1name" name="summary" nbsp="true"/></td>
            <td><custom:write property="area2name" name="summary" nbsp="true"/></td>
            <td><custom:write property="area3name" name="summary" nbsp="true" /></td>
            <td><custom:write property="salesrepname" name="summary" nbsp="true"/></td>
            <td><custom:write property="orgcode" name="summary" nbsp="true" /></td>
            <td><custom:write property="orgname" name="summary" nbsp="true" /></td>
            <td><custom:write property="selleroriginalname" name="summary" nbsp="true" /></td>
            <td><custom:write property="organalysisattr1" name="summary" nbsp="true" /></td>
            <td><custom:write  property="ischain" name="summary" dictType="YesOrNo" nbsp="true"/></td>
            <td><custom:write  property="islocked" name="summary" dictType="YesOrNo" nbsp="true"/></td>
            <td><custom:write property="partnerregionname" name="summary" nbsp="true"/></td>
            <td><custom:write property="partnercityname" name="summary" nbsp="true"/></td>
            <td><custom:write property="partnerarea1name" name="summary" nbsp="true"/></td>
            <td><custom:write property="partnerarea2name" name="summary" nbsp="true" /></td>
            <td><custom:write property="partnerarea3name" name="summary" nbsp="true"/></td>
            <td><custom:write property="partnersalesrepname" name="summary" nbsp="true" /></td>
            <td><custom:write property="partnetcode" name="summary" nbsp="true" /></td>
            <td><custom:write property="partnername" name="summary" nbsp="true" /></td>
            <td><custom:write property="partnerselleroriginalname" name="summary"  nbsp="true"/></td>
            <td><custom:write property="partnerstatus" name="summary" dictType="Status" nbsp="true"/></td>
            <td><custom:write property="partnerglobalpccode" name="summary" dictType="GlobalPCCode" nbsp="true"/></td>
            <td>&nbsp;
            <custom:write property="partanalysisattr3" name="summary" nbsp="true" />
           
            <custom:write property="partanalysisattr5" name="summary" nbsp="true" />
            </td>
            <td><custom:write  property="partnerischain" name="summary" dictType="YesOrNo" nbsp="true"/></td>
            <td><custom:write  property="partnerislocked" name="summary" dictType="YesOrNo" nbsp="true"/></td>
            <td><custom:write  property="partneristarget" name="summary" dictType="YesOrNo" nbsp="true"/></td>

            <td><custom:write property="itemcode" name="summary"  nbsp="true"/></td>
            <td><custom:write property="itemname" name="summary" nbsp="true"/></td>
            <td><custom:write property="specs" name="summary"  nbsp="true"/></td>
            <td><custom:write property="pcreatedate" name="summary" dataType="date" dataFormat="yyyy-MM-dd" nbsp="true"/></td>
            <td><custom:write property="purchasedate" name="summary" dataType="date" dataFormat="yyyy-MM-dd" nbsp="true"/></td>
            <td><custom:write property="qty" name="summary" nbsp="true" /></td>
            <!--  <td><%= label.getLabelName("L_Purchase") %></td>-->
            <td>
            
            <% if(globalpccode.equals(new Integer(112))){%>
            <%= label.getLabelName("L_PurchaseChannelInfo") %>
            <%}else{ %>
            <%= label.getLabelName("L_SalesDataFlow") %>
            <%} %>
            </td>
            <td><custom:write property="sdatatype" name="summary" dictType="Sdatatype" nbsp="true"/></td>
            <%
             if(summaryMap.get("flag")==null){
            %>
            <td>&nbsp;以岭发货</td>
            <%}else{ %>
            <td>&nbsp;<%="一级商的购进" %></td>
            <%} %>
          </tr>
          </logic:iterate>
      <% //--------------------------------------  flipping page --%>
        <tr> 
	            <td colspan="33" style="text-align:right"><%=label.getLabelName("L_TotalSum") +  label.getLabelName("L_Colon")%></td>
				<td class="red" colspan="3"><b><custom:write name="sumhash" property="sumallqty" nbsp="true" dataType="number" dataFormatName="qtyviewformat" /></b></td>
	         <%@ include file="/inc/SummaryAction.inc" %>
	   </tr>
      </table>
	  </div>
	  
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top"></td>
        </tr>
        <tr> 
          <td class="td_center">
          	<!-- <a onclick="page_excel();"><custom:button type="1" label="L_ExcelE" imgsrc="Modify.gif" border="0" style="width:100" privilegeCode="B0002"/></a>&nbsp;-->
            <a onclick="page_close();"><custom:button type="1" label="L_Close" imgsrc="edit.gif" border="0" style="width:80"/></a>
          </td>
        </tr>
      </table>
       
    </td>
  </tr>
  </form>
</table>
</body>
</html>